<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?
@session_start();
ob_start();
require_once('connect.php');
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet"  type="text/css" href="bootstrap-3.1.1-dist/css/bootstrap.css" />
<link rel="stylesheet"  type="text/css" href="css.css" />
<link rel="stylesheet"  type="text/css" href="css/cssmenubar.css"/>
<link rel="stylesheet"  type="text/css" href="cssviewtable.css"/>



<title>Untitled Document</title>
</head>
<body>
<div id="wrapper">
<div id="header"><img src="img/banner.jpg" width="100%" height="auto" ></div>

<div id="main">

    <div id='cssmenu'>
<ul>
   <li class='active'><a href='index.php'><span>Home</span></a></li>
   <li class='has-sub'><a href='#'><span>ข้อมูลพื้นฐาน</span></a>
      <ul>
         <li><a href='admin/view_customer.php' target="iframe_content"><span>แสดงข้อมูล</span></a></li>
         <li><a href='#'><span>Menus</span></a></li>
         <li class='last'><a href='#'><span>Products</span></a></li>
      </ul>
   </li>
   <li class='has-sub'><a href='#'><span>Company</span></a>
      <ul>
         <li><a href='#'><span>About</span></a></li>
         <li class='last'><a href='#'><span>Location</span></a></li>
      </ul>
   </li>
   <li class='last'><a href='#'><span>Contact</span></a></li>
   <li class='last'><a href='logout.php'><span>Log Out</span></a></li>
</ul><!--menu-->
</div>
<!----------------------------------------------------------------->
<div id='content'>
						<?
							require_once('connect.php');
							
							$method=$_REQUEST['method']; 
							$cus_id=$_REQUEST['cus_id'];
							if($method=='delete'){
									$strSQL = "DELETE FROM customer where cus_id='$cus_id'";
									$objQuery = mysql_query($strSQL)  or die(mysql_error());
									#echo $strSQL."<br>";
									if($objQuery)
										{ 
											echo " <script> alert('สำเร็จ');  window.location.assign('edit_cus.php')  </script>";
										}
										
										else {
											echo "<script> alert('ลบข้อมมูลไม่สำเร็จ');  window.location.assign('edit_cus.php')  </script>";
										
										}
							}
							
							$strSQL = "SELECT * FROM customer where cus_id='$cus_id'";
							$objQuery = mysql_query($strSQL)  or die(mysql_error());
							$data=mysql_fetch_array($objQuery);
						
						?>
		<form action="update_cus.php" method="post">
						<div="add_cus">	
							<center><br><br>
								<table>		
									<tr>
										<td>รหัส</td>
										<td>:&nbsp;<input type="text" name="cus_id" value="<?=$data['cus_id'];?>"></td>
									</tr>	
									
									<tr>
										<td>ชื่อ</td>
										<td>:&nbsp;<input type="text" name="cus_name" value="<?=$data['cus_name'];?>" ></td>
									</tr>
									
									<tr>
										<td>นามสกุล</td>
										<td>:&nbsp;<input type="text" name="cus_lname" value="<?=$data['cus_lname'];?>"></td>
									</tr>
									
									<tr>
										<td>เบอร์โทรศัพท์</td>
										<td>:&nbsp;<input type="text" name="cus_tel" value="<?=$data['cus_tel'];?>"></td>
									</tr>
									
									<tr>
										<td>ที่อยู่</td>
										<td>:&nbsp;<input type="text" name="cus_add" value="<?=$data['cus_add'];?>"></td>
									</tr>
									
									<tr>
										<td>ชื่อผู้ใช้งาน</td>
										<td>:&nbsp;<input type="text" name="username" value="<?=$data['username'];?>"></td>
									</tr>
								</table>
								
								<br><input type="submit" value="บันทึก">		
							</center>	
				
		</div>
<!----------------------------------------------------------------->
<div style="clear:both"></div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
